#include "main_interface.h"
#include "ui_main_interface.h"

#include "dashboard_widget.h"
#include <QSlider>
#include <QHBoxLayout>

MainInterface::MainInterface(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainInterface)
{
    ui->setupUi(this);

    QSlider *slider = new QSlider(this);
    slider->setRange(0, 100);
    DashBoardWidget *dashBoardWidget = new DashBoardWidget(this);
    dashBoardWidget->setUnit("°C");
    dashBoardWidget->setText("温度");
    connect(slider, &QSlider::valueChanged, dashBoardWidget, &DashBoardWidget::valueChanged);

    QWidget *widget = new QWidget(this);
    QHBoxLayout *layout = new QHBoxLayout(widget);
    layout->addWidget(dashBoardWidget);
    layout->addWidget(slider);
    setCentralWidget(widget);
    resize(500, 400);


}

MainInterface::~MainInterface()
{
    delete ui;
}
